#include <stdio.h>
#include <iostream>
#include <vector>
#include<algorithm>

int main(int argc, char* argv[])
{
	std::vector<int> datas = {0,1,2,3,4,5,6,7,8,9,0,1,2,3,5};

	std::for_each(datas.begin(), datas.end(), [](int a) { std::cout << a <<" "; });
	std::cout << std::endl;
	std::cout << "-----------------------------------------------------------------------" << std::endl;
	std::replace_if(datas.begin(), datas.end(), [](int a) { return a==0; },16);
	std::for_each(datas.begin(), datas.end(), [](int a) {std::cout << a << " "; });
	std::cout << std::endl;
	std::cout << "-----------------------------------------------------------------------" << std::endl;
	datas.erase(
		std::remove_if(datas.begin(), datas.end(), [](int a) {return a == 2; }), datas.end());
	std::for_each(datas.begin(), datas.end(), [](int a) { std::cout << a << " ";  });
	std::cout << std::endl;
	std::cout << "-----------------------------------------------------------------------"<<std::endl;
	std::vector<int>result;
	std::transform(datas.begin(), datas.end(), std::back_inserter(result), [](auto &itr) { return itr; });
	std::for_each(result.begin(), result.end(), [](int a) { std::cout << a << " "; });
	std::cout << std::endl;
	std::cout << "-----------------------------------------------------------------------" << std::endl;
	std::vector<int>idents_;
	std::vector<int>copied{0,1,2,3,4,5,6};
	std::sort(copied.begin(), copied.end());
	std::set_union(idents_.begin(), idents_.end(), copied.begin(), copied.end(), std::back_inserter(idents_));
	std::for_each(idents_.begin(), idents_.end(), [](int a) { std::cout << a << " "; });
	system("pause");
	return 0;
}